<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@page import="com.chc.util.Constant"%>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title> C & H</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link href="<%=request.getContextPath()%>/resources/css/bootstrap.min.css" rel="stylesheet" />
    <style type="text/css">
      .login-form {
        margin: 20px 0 0 0
      }
    </style>
  </head>

  <body>
    
    <div class="navbar navbar-inverse">
      <div class="navbar-inner">
        <div class="container-fluid">
          <a href="#" class="brand">C & H</a>
        </div>
      </div>
    </div>
    <div class="container-fluid">
      <div class="row-fluid">
        <div class="span3"></div>
        <div class="span6">
          <form action="<%=request.getContextPath()%>/login" method="post" class="form-horizontal login-form">
            <fieldset>
              <div class="control-group">
                <label class="control-label" for="loginName">Login ID</label>
                <div class="controls">
                  <input id="loginName" name="username" type="text" placeholder="Login ID" data-focus-first="true"/>
                </div>
              </div>
              <div class="control-group">
                <label class="control-label" for="pwd">password</label>
                <div class="controls">
                  <input id="pwd" name="password" type="password" placeholder="password"/>
                </div>
              </div>
              <div>
                <div class="controls">
                  <button class="btn btn-primary btn-large" id="subBtn" type="button">Login</button>
                </div>
              </div>  
                
            </fieldset>        
          </form>
        </div>
        <div class="span3"></div>
      </div>

    </div> <!-- /container -->

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="<%=request.getContextPath()%>/resources/js/jquery-1.8.2.min.js"></script>
    <script src="<%=request.getContextPath()%>/resources/js/bootstrap.min.js"></script>
    <script src="<%=request.getContextPath()%>/resources/js/jquery-ext.js"></script>
    <script type="text/javascript">
   	 var hostCx = '<%=request.getContextPath()%>';
    	$(function(){
    		$('#loginName').bind('keyup', function(evt) {
    			if(evt.keyCode == 13) {
    				$('#pwd').focus();
    			}
    		});
    		$('#pwd').bind('keyup', function(evt) {
    			if(evt.keyCode == 13) {
    				$('#subBtn').click();
    			}
    		});
    		
    		$("#subBtn").bind("click",function(){
    			var url=$("form").attr("action");
    			if(!validateEmpty([{label:'Login ID', val:$('#loginName').val()}])) {
    				$('#loginName').focus();
    				return;
    			}
    			if(!validateEmpty([{label:'password', val:$('#pwd').val()}])) {
    				$('#pwd').focus();
    				return;
    			}
    			$("form").submit();
    		});
    	});
    </script>
  </body>
</html>
